from .permission_serializer import PermissionSerializer
from sys_manager.models import RolesModel
from rest_framework.serializers import Serializer,ModelSerializer,IntegerField,BooleanField

class RolesSerializer(ModelSerializer):


    class Meta:
        model=RolesModel
        fields='__all__'



class RolesPartialSerializer(ModelSerializer):
    """ 用户局部更新序列化器(给角色授权) """
    class Meta:
        model = RolesModel
        fields = ['id', 'permissions']


class RoleSetPermissionSerializer(Serializer):
    role_id=IntegerField(write_only=True,required=True)
    permission_id=IntegerField(write_only=True,required=True)
    is_created=BooleanField(write_only=True,required=True)

